package repository

import (
	"golang-websocket-chatroom/global"
)

func Create[T any](data *T) bool {
	err := global.DB.Create(data).Error
	if err != nil {
		return false
	}
	return true
}
func WhereList[T any](where *T, data *T) bool {
	err := global.DB.Where(where).Find(data).Limit(1).Error
	if err != nil {
		return false
	}
	return true
}

func WhereLists[T any](where *T, data *[]T) bool {
	err := global.DB.Where(where).Find(data).Limit(1).Error
	if err != nil {
		return false
	}
	return true
}
